package com.gpf.marketing.controller;


import com.gpf.marketing.pojo.entity.AdvPosition;
import com.gpf.marketing.pojo.vo.AdvPoVo;
import com.gpf.marketing.service.AdvPositionService;
import com.seventh.common.pojo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: clms-fifth
 * @description: 广告位置的控制层
 * @author: 龚鹏飞
 * @create: 2021-07-21 19:07
 **/
@RestController
@RequestMapping("marketing/position")
public class AdvPositionController {
    @Autowired
    private AdvPositionService advPositionService;

    @PostMapping("selectAdvPosit/{currentPage}/{pageSize}")
    public R selectAdverPosit(@PathVariable("currentPage") Integer currentPage,
                              @PathVariable("pageSize") Integer pageSize,
                              @RequestBody AdvPoVo advPoVo){
        return advPositionService.selectAdvPosit(currentPage,pageSize,advPoVo);
    }

    @PostMapping("insertAdvPosit")
    public R insertAdvPosit(@RequestBody AdvPosition advtPosit){
        return advPositionService.insertAdvPosit(advtPosit);
    }
    @PutMapping("updateAdvPosit")
    public R updateAdvPosit(@RequestBody AdvPosition advtPosit){
        return advPositionService.updateAdvPosit(advtPosit);
    }

    @DeleteMapping("deleteAdvPosit/{id}")
    public R deleteAdvPosit(@PathVariable Integer id){
        return advPositionService.deleteById(id);
    }

    @GetMapping("byId/{id}")
    public R byId(@PathVariable Integer id){
        return advPositionService.selectById(id);
    }
    //下拉位置名称id
    @PostMapping("findAllId")
    public List<AdvPosition> findAllId(){
        return advPositionService.findAllId();
    }

}
